package com.zzl.alligator.management.vote.service.impl;


import com.zzl.alligator.management.vote.mapper.VoteViewUserMapper;
import com.zzl.alligator.management.vote.domain.VoteViewUser;
import com.zzl.alligator.management.vote.service.IVoteViewUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * 投票详情表(VoteViewUser)服务层
 *
 * @author zhouziliang
 * @since 2020-07-22
 */
@Service
public class VoteViewUserService implements IVoteViewUserService {
    
    @Autowired
    private VoteViewUserMapper voteViewUserMapper;
    
    /**
     * 通过ID查询单条数据
     *
     * @param subjectId 主键
     * @return 实例对象
     */
    @Override
    public VoteViewUser findVoteViewUserById(Long subjectId) {
        return voteViewUserMapper.findVoteViewUserById(subjectId);
    }

   /**
     * 通过实体作为筛选条件查询
     *
     * @param voteViewUser 实例对象
     * @return 对象列表
     */
    @Override
    public List<VoteViewUser> findVoteViewUserList(VoteViewUser voteViewUser) {
        return voteViewUserMapper.findVoteViewUserList(voteViewUser);
    }

    /**
     * 新增数据
     *
     * @param voteViewUser 实例对象
     * @return 实例对象
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int insertVoteViewUser(VoteViewUser voteViewUser) {
        return voteViewUserMapper.insertVoteViewUser(voteViewUser);
    }

    /**
     * 修改数据
     *
     * @param voteViewUser 实例对象
     * @return 实例对象
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateVoteViewUser(VoteViewUser voteViewUser) {
        return voteViewUserMapper.updateVoteViewUser(voteViewUser);
    }

    /**
     * 通过主键删除数据
     *
     * @param subjectId 主键
     * @return 是否成功
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteById(Long subjectId) {
        return voteViewUserMapper.deleteById(subjectId);
    } 
    
}